package com.day3.Two;



import java.lang.reflect.Method;

public class Two {
    public static void main(String[] args) throws Exception {
        Class<?> aClass = Class.forName("com.day3.Two.TwoBo");

        Method fun1 = aClass.getDeclaredMethod("fun1");

        Object o = aClass.newInstance();
        Object result = fun1.invoke(o);
        System.out.println(result);

        Method fun2 = aClass.getDeclaredMethod("fun2", String.class, Integer.class);
        Object r = fun2.invoke(o, "樊博士", 18);
        System.out.println(r);

    }
}

class TwoFan{
    public void show(){
        System.out.println("show方法");
    }
    private void print(){
        System.out.println("print方法");
    }
}
class TwoBo extends TwoFan {
    public void fun1(){
        System.out.println("fun1方法");
    }
    public String fun2(String name,Integer age){
        System.out.println("fun2方法"+name);
        return "2222";
    }
}